package com.lvmama.controller.dw.priceStock;

import com.github.pagehelper.PageInfo;
import com.lvmama.common.result.Result;
import com.lvmama.common.utils.PageInfoUtil;
import com.lvmama.pojo.dto.dw.PriceDetailQuery;
import com.lvmama.pojo.entity.dw.priceStock.PriceDetail;
import com.lvmama.service.dw.PriceService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Author:xuzhongwei
 * @Description:
 * @Date：2018/08/06
 */
@RestController
@RequestMapping("/price")
public class PriceController {

    @Autowired
    PriceService priceService;

    /**
     * 查询价格详情
     *
     * @param query 查询条件
     * @return 价格详情
     */
    @PostMapping("/selectPriceDetail")
	public Result<List<PriceDetail>> selectPriceDetail(@RequestBody PriceDetailQuery query){
    	return this.priceService.selectPriceDetail(query);
    }

    /**
     * 查询价格详情分页-非房型
     *
     * @param query 查询条件
     * @return 价格详情分页
     */
    @PostMapping("/selectPriceDetailPage")
	Result<PageInfo<PriceDetail>> selectPriceDetailPage(@RequestBody PriceDetailQuery query){
    	return this.priceService.selectPriceDetailPage(query);
    }

    /**
     * 查询每条价格详情分页-房型明细
     *
     * @param query 查询条件
     * @return 每条价格详情分页
     */
    @PostMapping("/selectAllPriceDetailPage")
	Result<PageInfo<PriceDetail>> selectAllPriceDetailPage(@RequestBody PriceDetailQuery query){
    	return this.priceService.selectAllPriceDetailPage(query);
    }

    /**
     * 查询价格汇总详情
     *
     * @param query 查询条件
     * @return 价格详情
     */
    @PostMapping("/selectPriceGather")
	Result<List<PriceDetail>> selectPriceGather(@RequestBody PriceDetailQuery query){
    	return this.priceService.selectPriceGather(query);
    }

    /**
     * 查询价格汇总详情分页-读缓存
     * @param query 查询条件
     * @return 价格详情分页
     */
    @PostMapping("/selectPriceGatherPageByRedis")
	Result<PageInfoUtil<PriceDetail>> selectPriceGatherPageByRedis(@RequestBody PriceDetailQuery query){
    	return this.priceService.selectPriceGatherPageByRedis(query);
    }
}
